package o;

import android.app.Activity;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import com.huawei.appgallery.foundation.account.bean.UserSession;
import com.huawei.appgallery.foundation.ui.framework.activity.AbstractBaseActivity;
import com.huawei.appgallery.foundation.ui.framework.widget.dialog.dialogactivity.DialogActivity.a;
import com.huawei.appmarket.R;

public class dgj implements AccountBussinessListener {
    private String ˏ = "";

    private dgj(Context context) {
    }

    public static void ˎ(Context context) {
        eoj.ˋ().ˎ("signin", new dgj(context));
    }

    public void onAccountBusinessResult(ccp o_ccp) {
        Logger.ˎ("GLOBAL_START_FLOW", "StoreAccountObserver onAccountBusinessResult " + o_ccp);
        if (103 == o_ccp.ˎ) {
            ˋ();
            new Handler(Looper.getMainLooper()).post(new 5(this));
        } else if (102 == o_ccp.ˎ) {
            ˋ();
            eec.ˊ().ˎ();
            new eoh().ˎ();
        }
    }

    private void ˋ() {
        ((cut) fho.ˏ().ˋ("RealName").ॱ(cut.class)).ˎ();
    }

    private void ॱ() {
        String ॱ = eqp.ॱ();
        String lastHomeCountry = UserSession.getInstance().getLastHomeCountry();
        if (dof.ˋ(lastHomeCountry) || lastHomeCountry.equals(ॱ)) {
            boolean z = false;
        } else {
            dgh.ˏ();
            diu.ˊ().ॱ();
            ((bod) bkt.ˋ("DynamicCore", bod.class)).ˎ();
            dvt.ˏ().ˋ(1);
            dhq.ॱ().ˊ();
            euf.ˎ().ॱॱ();
            egv.ॱᐝ().ˏॱ();
            egn.ˎ().ॱ();
            int i = 1;
        }
        if (ActivityUtil.ˋ(ContentManager.getInstant().getContext())) {
            Logger.ˎ("StoreAccountObserver", "logoutOperation restartApplication");
            this.ˏ = "app_market";
            Activity ʻॱ = AbstractBaseActivity.ʻॱ();
            int ˎ = dgm.ˎ(ʻॱ);
            if (ˎ == 17) {
                this.ˏ = "app_child";
            } else if (ˎ == 18) {
                this.ˏ = "app_edu";
            }
            if (ʻॱ == null) {
                Logger.ˎ("StoreAccountObserver", "logoutOperation exitApp isAppShowing");
                UserSession.getInstance().setLastHomeCountry("");
                dzv.ˊ();
            } else if (eqp.ॱˊ()) {
                dzv.ˊ(this.ˏ);
            } else {
                Logger.ˎ("StoreAccountObserver", "isNeedSoreServiceZone=false");
                if (i != 0) {
                    Logger.ˎ("StoreAccountObserver", "isNeedSoreServiceZone=false show change dialog");
                    ˊ(ʻॱ);
                } else {
                    dzv.ˊ(this.ˏ);
                }
                UserSession.getInstance().setLastHomeCountry("");
            }
        } else {
            Logger.ˎ("StoreAccountObserver", "logoutOperation exitApp");
            UserSession.getInstance().setLastHomeCountry("");
            dzv.ˊ();
        }
        euf.ˎ().ˊ(false);
        dty.ॱ().ˊ();
    }

    private void ˊ(Context context) {
        Logger.ˎ("GLOBAL_START_FLOW", "StoreAccountObserver showChangDlg");
        dgh.ˏ();
        diu.ˊ().ॱ();
        ((bod) bkt.ˋ("DynamicCore", bod.class)).ˎ();
        dvt.ˏ().ˋ(1);
        dhq.ॱ().ˊ();
        euf.ˎ().ॱॱ();
        ekg.ॱ().ˏ();
        String ˊ = eqp.ˊ();
        egn.ˎ().ॱ();
        eec.ˊ().ˏ();
        new a(context, "HomeCountryChangeDialog").ॱ(context.getString(R.string.hispace_global_protocol_switch_new, new Object[]{ˊ})).ˊ(-2, 8).ˏ(new a(this, context)).ˋ(-1, (int) R.string.exit_confirm).ॱ(false).ˎ();
    }

    private void ˋ(Context context) {
        Logger.ˎ("StoreAccountObserver", "StoreAccountObservershowProtocol");
        diu.ˊ().ॱ((Activity) context, new 2(this));
    }
}
